package cn.iocoder.yudao.module.wms.dal.mysql.stockserial;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wms.dal.dataobject.stockserial.StockSerialDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wms.controller.admin.stockserial.vo.*;

/**
 * 库存序列号 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface StockSerialMapper extends BaseMapperX<StockSerialDO> {

    default PageResult<StockSerialDO> selectPage(StockSerialPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StockSerialDO>()
                .eqIfPresent(StockSerialDO::getProductId, reqVO.getProductId())
                .eqIfPresent(StockSerialDO::getWarehouseId, reqVO.getWarehouseId())
                .eqIfPresent(StockSerialDO::getPositionId, reqVO.getPositionId())
                .eqIfPresent(StockSerialDO::getSerialNo, reqVO.getSerialNo())
                .eqIfPresent(StockSerialDO::getInDocId, reqVO.getInDocId())
                .eqIfPresent(StockSerialDO::getInDocCode, reqVO.getInDocCode())
                .eqIfPresent(StockSerialDO::getOutDocId, reqVO.getOutDocId())
                .eqIfPresent(StockSerialDO::getOutDocCode, reqVO.getOutDocCode())
                .eqIfPresent(StockSerialDO::getInFlag, reqVO.getInFlag())
                .eqIfPresent(StockSerialDO::getOutFlag, reqVO.getOutFlag())
                .eqIfPresent(StockSerialDO::getStockDetailId, reqVO.getStockDetailId())
                .betweenIfPresent(StockSerialDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StockSerialDO::getId));
    }

}